﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<nelech.Models.DBModel.ListTrack>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    תוצאות חיפוש - נלך
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="left">
        <%Html.RenderAction("AdvertShowThree", "Advert", new { id = 7 });%>
    </div>
    <div id="main">
        <% var tracks = Model.tracks; %>
        <% if (Model.isSearch)
           { %>
        <h2>
            נלך- תוצאות חיפוש</h2>
        <%} %>
        <% else
           {
               if (Model.isFree == 1)
               {%>
        <h2>
            טיולים ללא תשלום
        </h2>
        <%}
         else
         {%>
        <h2>
            טיולים בתשלום</h2>
        <%}
     }%>
        <% if (Model.isEmpty)
           {%>
        <h3>
            לא נמצאו תוצאות תואמות</h3>
        <%} %>
        <%else
           { %>
        <% foreach (var item in tracks)
           { %>
        <fieldset class="recommended">
            <legend>
                <%= Html.ActionLink(item.title, "TrackInfo", new { id = item.number })%>
            </legend>
            <p class="floatright">
                <% if (item.Image.Count > 0)
                   {
                       var images = item.Image.OrderBy(p => p.path);
                       var firstImage = images.First();
                       var smallImageName = System.IO.Path.GetFileName(firstImage.path.Replace("\\", "/"));
                %>
                <img src="<%= "/Upload/Thumbs/" + smallImageName %>" alt="<%= firstImage.text %>"
                    width="150px" />
                <% } %>
            </p>
            <p>
                <%= Html.Encode(item.summary)%>
            </p>
            <p>
                <span class="bold">מפת סימון שבילים: </span>
                <%= Html.Encode(item.Regeon1.id + " - " + item.Regeon1.text)%><br />
                <span class="bold">דרכי הגעה:</span>
                <%    foreach (var traffic in item.Traffic)
                      {
                          Response.Write(traffic.text + ", ");
                      }
             
                %></p>
            <p>
                <%= Html.ActionLink("להרחבה", "TrackInfo", new { id = item.number })%></p>
        </fieldset>
        <% }
        }%>
        <br />
        <%= Html.ActionLink("לרשימת כל המסלולים", "AllList", "Home", new {id = 1 },null)%>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="publishTop" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Right" runat="server">
    <%var count = (int)ViewData["advertCount"];
        var array = (int[])ViewData["advertsArray"];
        if (count > 0)
        {

            Html.RenderAction("AdvertShowThree", "Advert", new { id = 6, noRandom = array[0] });%> 
         <%} %>
</asp:Content>

<asp:Content ID="Content5" ContentPlaceHolderID="RightAdvert" runat="server">
<%var count = (int)ViewData["advertCount"];
  var array = (int[])ViewData["advertsArray"];
  if (count > 0)
  {

      Html.RenderAction("AdvertShow", "Advert", new { id = 6, random1 = array[0] });
  }%>
  
</asp:Content>
 
